package com.mrd.gtimp.business.entity;

import com.mrd.annotation.validation.MRDLength;
import com.mrd.gtimp.base.entity.Company;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

/**
 * <p>
 * application name: sample
 * <p>
 * copyright: Copyright@2012 明睿达科技有限公司
 */

/**
 * 联系人信息
 * @author winaya
 */
@Entity(name = "T_BIZ_CONTACTER")
public class Contacter implements Serializable {

	private static final long	serialVersionUID	= 1L;
	@Id
	// @GeneratedValue(generator = "paymentableGenerator")
	// @GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
	@Column(name = "ID")
	@MRDLength(max = 32)
	public String				id;

	/**
	 * 联系人归属
	 */
	@ManyToOne
	@JoinColumn(name = "COM_ID", updatable = false)
	public Company				owner;

	/**
	 * 姓名
	 */
	@Column(name = "NAME")
	@MRDLength(max = 30)
	public String				name;
	/**
	 * 联系电话
	 */
	@Column(name = "PHONE")
	@MRDLength(max = 50)
	public String				phone;
	/**
	 * 移动电话
	 */
	@Column(name = "MPHONE")
	@MRDLength(max = 50)
	public String				mobilePhone;
	/**
	 * 公司名称
	 */
	@MRDLength(max = 100)
	@Column(name = "COMPANY_NAME")
	public String				company;
	/**
	 * 联系地址
	 */
	@MRDLength(max = 200)
	@Column(name = "ADDRESS")
	public String				address;
	/**
	 * 邮编
	 */
	@MRDLength(max = 6)
	@Column(name = "ZIP")
	public String				zip;
	/**
	 * 传真
	 */
	@MRDLength(max = 50)
	@Column(name = "FAX")
	public String				fax;
	/**
	 * 电子邮箱
	 */
	@MRDLength(max = 50)
	@Column(name = "EMAIL")
	public String				email;

	/**
	 * 市
	 */
	@MRDLength(max = 20)
	@Column(name = "CITY")
	public String				city;

	/**
	 * 市ID
	 */
	@MRDLength(max = 32)
	@Column(name = "CITY_ID")
	public String				cityId;
	/**
	 * 区
	 */
	@MRDLength(max = 32)
	@Column(name = "AREA")
	public String				area;

	/**
	 * 区ID
	 */
	@MRDLength(max = 32)
	@Column(name = "AREA_ID")
	public String				areaId;
	/**
	 * 街道
	 */
	@MRDLength(max = 32)
	@Column(name = "TOWN")
	public String				town;

	/**
	 * 街道ID
	 */
	@MRDLength(max = 32)
	@Column(name = "TOWN_ID")
	public String				townId;

	private String				CREATOR;
	private Date				CTIME;
	private String				MODIFIER;
	private Date				MTIME;

	/**
	 * 启用模式(0:启用，1:禁用)
	 */
	@Column(name = "ISABLED")
	private String				isAbled;

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((CREATOR == null) ? 0 : CREATOR.hashCode());
		result = prime * result + ((CTIME == null) ? 0 : CTIME.hashCode());
		result = prime * result + ((MODIFIER == null) ? 0 : MODIFIER.hashCode());
		result = prime * result + ((MTIME == null) ? 0 : MTIME.hashCode());
		result = prime * result + ((address == null) ? 0 : address.hashCode());
		result = prime * result + ((city == null) ? 0 : city.hashCode());
		result = prime * result + ((cityId == null) ? 0 : cityId.hashCode());
		result = prime * result + ((area == null) ? 0 : area.hashCode());
		result = prime * result + ((areaId == null) ? 0 : areaId.hashCode());
		result = prime * result + ((town == null) ? 0 : town.hashCode());
		result = prime * result + ((townId == null) ? 0 : townId.hashCode());
		result = prime * result + ((company == null) ? 0 : company.hashCode());
		result = prime * result + ((email == null) ? 0 : email.hashCode());
		result = prime * result + ((fax == null) ? 0 : fax.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((isAbled == null) ? 0 : isAbled.hashCode());
		result = prime * result + ((mobilePhone == null) ? 0 : mobilePhone.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + ((owner == null) ? 0 : owner.hashCode());
		result = prime * result + ((phone == null) ? 0 : phone.hashCode());
		result = prime * result + ((zip == null) ? 0 : zip.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if(this == obj)
			return true;
		if(obj == null)
			return false;
		if(getClass() != obj.getClass())
			return false;
		Contacter other = (Contacter) obj;
		if(CREATOR == null) {
			if(other.CREATOR != null)
				return false;
		} else if(!CREATOR.equals(other.CREATOR))
			return false;
		if(CTIME == null) {
			if(other.CTIME != null)
				return false;
		} else if(!CTIME.equals(other.CTIME))
			return false;
		if(MODIFIER == null) {
			if(other.MODIFIER != null)
				return false;
		} else if(!MODIFIER.equals(other.MODIFIER))
			return false;
		if(MTIME == null) {
			if(other.MTIME != null)
				return false;
		} else if(!MTIME.equals(other.MTIME))
			return false;
		if(address == null) {
			if(other.address != null)
				return false;
		} else if(!address.equals(other.address))
			return false;
		if(city == null) {
			if(other.city != null)
				return false;
		} else if(!city.equals(other.city))
			return false;
		if(cityId == null) {
			if(other.cityId != null)
				return false;
		} else if(!cityId.equals(other.cityId))
			return false;
		if(area == null) {
			if(other.area != null)
				return false;
		} else if(!area.equals(other.area))
			return false;
		if(areaId == null) {
			if(other.areaId != null)
				return false;
		} else if(!areaId.equals(other.areaId))
			return false;
		if(town == null) {
			if(other.town != null)
				return false;
		} else if(!town.equals(other.town))
			return false;
		if(townId == null) {
			if(other.townId != null)
				return false;
		} else if(!townId.equals(other.townId))
			return false;
		if(company == null) {
			if(other.company != null)
				return false;
		} else if(!company.equals(other.company))
			return false;
		if(email == null) {
			if(other.email != null)
				return false;
		} else if(!email.equals(other.email))
			return false;
		if(fax == null) {
			if(other.fax != null)
				return false;
		} else if(!fax.equals(other.fax))
			return false;
		if(id == null) {
			if(other.id != null)
				return false;
		} else if(!id.equals(other.id))
			return false;
		if(isAbled == null) {
			if(other.isAbled != null)
				return false;
		} else if(!isAbled.equals(other.isAbled))
			return false;
		if(mobilePhone == null) {
			if(other.mobilePhone != null)
				return false;
		} else if(!mobilePhone.equals(other.mobilePhone))
			return false;
		if(name == null) {
			if(other.name != null)
				return false;
		} else if(!name.equals(other.name))
			return false;
		if(owner == null) {
			if(other.owner != null)
				return false;
		} else if(!owner.equals(other.owner))
			return false;
		if(phone == null) {
			if(other.phone != null)
				return false;
		} else if(!phone.equals(other.phone))
			return false;
		if(zip == null) {
			if(other.zip != null)
				return false;
		} else if(!zip.equals(other.zip))
			return false;
		return true;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getMobilePhone() {
		return mobilePhone;
	}

	public void setMobilePhone(String mobilePhone) {
		this.mobilePhone = mobilePhone;
	}

	public String getCompany() {
		return company;
	}

	public void setCompany(String company) {
		this.company = company;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getZip() {
		return zip;
	}

	public void setZip(String zip) {
		this.zip = zip;
	}

	public String getFax() {
		return fax;
	}

	public void setFax(String fax) {
		this.fax = fax;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Company getOwner() {
		return owner;
	}

	public void setOwner(Company owner) {
		this.owner = owner;
	}

	@Column(updatable = false)
	public String getCREATOR() {
		return CREATOR;
	}

	public void setCREATOR(String cREATOR) {
		CREATOR = cREATOR;
	}

	@Column(updatable = false)
	public Date getCTIME() {
		return CTIME;
	}

	public void setCTIME(Date cTIME) {
		CTIME = cTIME;
	}

	public String getMODIFIER() {
		return MODIFIER;
	}

	public void setMODIFIER(String mODIFIER) {
		MODIFIER = mODIFIER;
	}

	public Date getMTIME() {
		return MTIME;
	}

	public void setMTIME(Date mTIME) {
		MTIME = mTIME;
	}

	public String getIsAbled() {
		return isAbled;
	}

	public void setIsAbled(String isAbled) {
		this.isAbled = isAbled;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getArea() {
		return area;
	}

	public void setArea(String area) {
		this.area = area;
	}

	public String getTown() {
		return town;
	}

	public void setTown(String town) {
		this.town = town;
	}

	public String getCityId() {
		return cityId;
	}

	public void setCityId(String cityId) {
		this.cityId = cityId;
	}

	public String getAreaId() {
		return areaId;
	}

	public void setAreaId(String areaId) {
		this.areaId = areaId;
	}

	public String getTownId() {
		return townId;
	}

	public void setTownId(String townId) {
		this.townId = townId;
	}

}
